<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>">
		<title>insert title</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">    
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
			<link rel="stylesheet" type="text/css" href="styles.css">
		-->
		<script src="scripts/jquery-1.9.1.js"></script>
		<script>
			function uploadData(){
				var collegeList = new Array();
				$("#college #data tr").each(function(){
					var collegeNo = $(this).children("#collegeNo").text();
					var collegeName = $(this).children("#collegeName").text();
					collegeList.push({"collegeNo":collegeNo,"coolegeName":collegeName});
				});
				var data1 = JSON.stringify(collegeList);
				//alert(data1);
				$.ajax({
					url:'<%=basePath%>test/test01',
					dataType:'text',
					type:'POST',
					data:data1,
					contentType : 'application/json;charset=utf-8',
					success:function(text){
						alert(text);
					},
					error:function(){
						alert("error");
					}
					
				});
			}
		</script>
	</head>
	<body>
		<h1>解决考试答案提交的模块</h1>
		<table id="college">
			<thead>
			<tr>
				<th>学院编号</th>
				<th>学院名称</th>
			</tr>
			</thead>
			<tbody id="data"y>
				<tr>
					<td id="collegeNo">01</td>
					<td id="collegeName">aaa</td>
				</tr>
				<tr>
					<td id="collegeNo">02</td>
					<td id="collegeName">bbb</td>
				</tr>
				<tr>
					<td id="collegeNo">03</td>
					<td id="collegeName">ccc</td>
				</tr>
				<tr>
					<td id="collegeNo">04</td>
					<td id="collegeName">ddd</td>
				</tr>
				<tr>
					<td id="collegeNo">05</td>
					<td id="collegeName">eee</td>
				</tr>
				<tr>
					<td id="collegeNo">06</td>
					<td id="collegeName">fff</td>
				</tr>
			</tbody>
		</table>
		<button onclick="uploadData();">上传</button>
	</body>
</html>